home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic 4 Database How-To
/
Visual Basic 4 Database - How-to (The Waite Group)(1995).iso
/
readini.ba_
/
readini.ba
Wrap
Text File
|
1995-07-04
|
2KB
|
50 lines
Attribute VB_Name = "INIFileReader"
Option Explicit
Const INI_SECTION = "Data Files"
Const INI_FILENAME = "VBDBHT.INI"
Const MAX_PATH = 128
#If Win32 Then
Declare Function GetPrivateProfileString _
Lib "Kernel32" Alias "GetPrivateProfileStringA" (ByVal lpSectionName As String, _
ByVal lpKeyName As Any, ByVal lpDefault As String, _
ByVal lpReturnedString As String, ByVal Size As Integer, _
ByVal lpFileName As String) As Integer
#Else
Declare Function GetPrivateProfileString _
Lib "Kernel" (ByVal lpSectionName As String, _
ByVal lpKeyName As Any, ByVal lpDefault As String, _
ByVal lpReturnedString As String, ByVal Size As Integer, _
ByVal lpFileName As String) As Integer
#End If
Public Function BiblioPath() As String
' Returns the fully qualiied path name to BIBLIO.MDB,
' as recorded in VBDBHT.INI.
' Returns an empty string if information is not found.
Dim lpReturnedString As String * MAX_PATH
Dim bytesBack As Integer
bytesBack = GetPrivateProfileString(INI_SECTION, _
"BIBLIO", "", lpReturnedString, MAX_PATH, INI_FILENAME)
BiblioPath = IIf(bytesBack > 0, Left$(lpReturnedString, bytesBack) & "\BIBLIO.MDB", "")
End Function
Public Function DataPath() As String
' Returns the top-level VBDBHT directory
Dim lpReturnedString As String * MAX_PATH
Dim bytesBack As Integer
bytesBack = GetPrivateProfileString(INI_SECTION, _
"Data", "", lpReturnedString, MAX_PATH, INI_FILENAME)
DataPath = IIf(bytesBack > 0, Left$(lpReturnedString, bytesBack), "")
End Function